#ifndef STATE_H
#define	STATE_H

#include "objectBase.h"
#include "KlinkTimer.h"

// Forward Declare our Actor class
class CActor;

// defines
#define MESSAGE_FREQUENCY	500		// frequency of update messages (500ms = 0.5s)

class CState
{
	protected:

		CActor	*	pActor;	// The associated actor with this state

		int nStateId;	// a unique id for each state

		CKlinkTimer	messageTimer;	// Set a timer to post the update message to the queue
									// every 1/2 second

	public:

		static int	nStatesNewed,	//statistic information 
					nStatesDeleted;

		CState();

		virtual ~CState();

		/******************************************************************************/
		//	Enter	-	Enters into the state
		//
		//	Note:	This is a pure virtual function and must be overridden by its children
		/******************************************************************************/
		virtual void	Enter() = 0;

		/******************************************************************************/
		//	Update	-	Performs updates for the state
		//
		//	Return:	TRUE if successful
		//	Note:	This is a pure virtual function and must be overridden by its children
		/******************************************************************************/
		virtual bool	Update() = 0;

		/******************************************************************************/
		//	Exit	-	Exits out of the state
		//
		//	Note:	This is a pure virtual function and must be overridden by its children
		/******************************************************************************/
		virtual void	Exit() = 0;

		int GetId() { return nStateId; }
};

class CStateIdle : public CState
{
	public:

		CStateIdle(CActor * _pActor)
		{
			// Remember the associated actor
			pActor = _pActor;
		}

		~CStateIdle(){}

		/******************************************************************************/
		//	Enter	-	Enters into the state
		/******************************************************************************/
		void	Enter();

		/******************************************************************************/
		//	Update	-	Performs updates for the state
		//
		//	Return:	TRUE if successful
		/******************************************************************************/
		bool	Update();

		/******************************************************************************/
		//	Exit	-	Exits out of the state
		/******************************************************************************/
		void	Exit();
};

class CStateFight : public CState
{
	public:

		CStateFight(CActor * _pActor)
		{
			// Remember the associated actor
			pActor = _pActor;
		}

		~CStateFight(){}

		/******************************************************************************/
		//	Enter	-	Enters into the state
		/******************************************************************************/
		void	Enter();

		/******************************************************************************/
		//	Update	-	Performs updates for the state
		//
		//	Return:	TRUE if successful
		/******************************************************************************/
		bool	Update();

		/******************************************************************************/
		//	Exit	-	Exits out of the state
		/******************************************************************************/
		void	Exit();

};

class CStateBlock : public CState
{
	public:

		CStateBlock(CActor * _pActor)
		{
			// Remember the associated actor
			pActor = _pActor;
		}

		~CStateBlock(){}

		/******************************************************************************/
		//	Enter	-	Enters into the state
		/******************************************************************************/
		void	Enter();

		/******************************************************************************/
		//	Update	-	Performs updates for the state
		//
		//	Return:	TRUE if successful
		/******************************************************************************/
		bool	Update();

		/******************************************************************************/
		//	Exit	-	Exits out of the state
		/******************************************************************************/
		void	Exit();
};

#endif